package com.aspire.android.heliar.ui;

import com.aspire.android.heliar.pub.ContentNode;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

public class ContentNodeShareButtonClickListener implements OnClickListener {

	private Activity activity;
	private ContentNode contentNode;

	public ContentNodeShareButtonClickListener(Activity activity,
			ContentNode contentNode) {
		this.contentNode = contentNode;
		this.activity = activity;
	}

	@Override
	public void onClick(View view) {
		Intent intent = new Intent(Intent.ACTION_SEND);
		intent.setType("text/plain");
		intent.putExtra(Intent.EXTRA_SUBJECT, contentNode.getTitle());
		intent.putExtra(Intent.EXTRA_TEXT, contentNode.getTitle() + "\n" + contentNode.getContent());
		activity.startActivity(Intent.createChooser(intent,
				contentNode.getTitle()));
	}
}
